"""
线索主页面
"""
from selenium.webdriver.common.by import By
from page.base_page import BasePage
class ClueMainPage(BasePage):
    #元素定位器
    #下一页按钮
    xs_next_locator = (By.LINK_TEXT, "下一页 »")
    #新建线索按钮
    xs_add_locator = (By.CSS_SELECTOR, "body > div.container > div.row > div:nth-child(1) > div > a")
    #线索列表
    xs_table_locator = (By.CSS_SELECTOR, "#form1 > table > tbody")
    #查看按钮
    xs_table_ck_element_locator = (By.LINK_TEXT, "查看")
    #统计按钮
    xiansuotongji_btn_locator = (By.CSS_SELECTOR, 'body > div.container > div.page-header > ul > li:nth-child(3) > a')
    #线索列表


    #点击下一页按钮
    def click_xsc_btn(self):
        self.driver.find_element(*self.xs_next_locator).click()

    #点击新建线索按钮
    def click_xjsx_btn(self):
        self.driver.find_element(*self.xs_add_locator).click()

    #点击查看按钮
    def click_ck_btn(self):
        table = self.driver.find_element(*self.xs_table_locator)
        table.find_element(*self.xs_table_ck_element_locator).click()

    #点击统计按钮
    def click_tj_btn(self):
        self.driver.find_element(*self.xiansuotongji_btn_locator).click()

    def get_table_element(self):
        return self.driver.find_element(*self.xs_table_locator)